package com.guage.service.impl;

import com.guage.model.ShopImages;
import com.guage.mapper.ShopImagesMapper;
import com.guage.service.IShopImagesService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.guage.commons.result.PageInfo;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 图片素材 服务实现类
 * </p>
 *
 * @author dechao.yang
 * @since 2017-12-14
 */
@Service
public class ShopImagesServiceImpl extends ServiceImpl<ShopImagesMapper, ShopImages> implements IShopImagesService {

     @Autowired
     private ShopImagesMapper shopImagesMapper;
	
	@Override
	public void selectDataGrid(PageInfo pageInfo) {        
        Page<ShopImages> page = new Page<ShopImages>(pageInfo.getNowpage(), pageInfo.getSize());        
        EntityWrapper<ShopImages> wrapper = new EntityWrapper<ShopImages>();
        wrapper.orderBy(pageInfo.getSort(), pageInfo.getOrder().equalsIgnoreCase("ASC"));
        selectPage(page, wrapper);        
        pageInfo.setRows(page.getRecords());
        pageInfo.setTotal(page.getTotal());
	}

	@Override
	public void insertByVo(ShopImages shopImagesVo) {
		shopImagesMapper.insert(shopImagesVo);
	}
}
